<?php

use common\models\Adminuser;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\grid\ActionColumn;
use yii\grid\GridView;

/** @var yii\web\View $this */
/** @var common\models\AdminuserSearch $searchModel */
/** @var yii\data\ActiveDataProvider $dataProvider */

$this->title = '管理员管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="adminuser-index">

    <h1><?= Html::encode($this->title) ?></h1>

    <p>
        <?= Html::a('新增管理员', ['create'], ['class' => 'btn btn-success']) ?>
    </p>

    <?php // echo $this->render('_search', ['model' => $searchModel]); ?>

    <?= GridView::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'columns' => [
            ['class' => 'yii\grid\SerialColumn'],

            'id',
            'username',
            'nickname',
            'email:email',
            //'profile:ntext',
            //'auth_key',
            //'password_hash',
            //'password_reset_token',
            [
                'class' => ActionColumn::className(),
                'urlCreator' => function ($action, Adminuser $model, $key, $index, $column) {
                    return Url::toRoute([$action, 'id' => $model->id]);
                 }
            ],

            /*['class' => 'yii\grid\ActionColumn',
                    'template'=>'{view} {update} {resetpwd} {privilege}',
                    'buttons'=>[
                            'resetpwd'=>function($url,$model,$key)
                            {
                                $options=[
                                        'title'=>Yii::t('yii','重置密码'),
                                        'aria-label'=>Yii::t('yii','重置密码'),
                                        'data-pjax'=>'0',
                                        ];
                                return Html::a('<span class="glyphicon glyphicon-lock"></span>',$url,$options);
                            },
                            
                            'privilege'=>function($url,$model,$key)
                            {
                                $options=[
                                        'title'=>Yii::t('yii','权限'),
                                        'aria-label'=>Yii::t('yii','权限'),
                                        'data-pjax'=>'0',
                                ];
                                return Html::a('<span class="glyphicon glyphicon-user"></span>',$url,$options);
                            },
                        ],
            ],*/
        ],
    ]); ?>


</div>
